import { PuppeteerServer } from '../server/PuppeteerServer'
(async function () {
    let p = new PuppeteerServer();

    //实例化页面
    await p.createPage("http://www.baidu.com")

    //Button选择器点击，如果输入Url参数就开启监听请求
    await p.Button.tapButton('#button');

    //Input
    await p.Input.typeValue('#kw', "hello");

    //判断模态框开启
    let PreModeIds = await p.Button.getAllModalIds('模态框样式')
    await p.Button.tapButton('Button样式');
    let NowModeIds = await p.Button.getAllModalIds('模态框样式');

    if(PreModeIds == NowModeIds){
        throw '模态框弹出失败'
    }

    //模态框关闭

    let selector:string = await p.Button.getLatestModalId("模态框样式");
    let r:boolean = await p.Button.isDomExist(selector);
    if(r){
        throw '模态框关闭失败'
    }
    //
})()
